home *** CD-ROM | disk | FTP | other *** search
/ Apple Developer Connection 1998 Fall: Game Toolkit / Disc.iso / SDKs / PCI Driver Development Kit / • Tools / Utility / DisplayNameRegistry 950412 / Src / DisplayNameRegistry.h < prev    next >
Encoding:
C/C++ Source or Header  |  1997-02-27  |  8.0 KB  |  349 lines  |  [TEXT/MPCC]

  1. /*                                    DisplayNameRegistry.h                            */
  2. /*
  3.  * DisplayNameRegistry.h
  4.  * Copyright © 1993-94 Apple Computer Inc. All rights reserved.
  5.  */
  6. #ifndef __NameRegistryDisplay__
  7. #define __NameRegistryDisplay__
  8.  
  9. #define kVersionMajor        1
  10. #define kVersionMinor        0
  11. #define kVersionStage        beta    /* Res only */
  12. #define kVersionStageLetter    'b'
  13. #define kVersionRelease        1
  14. #define kApplicationCreator    'DNPR'
  15. #define MBAR_MenuBar        1
  16. #define MENU_Apple            1
  17. #define MENU_File            256
  18. #define MENU_Edit            257
  19. #define MENU_Options        258
  20. #define MENU_FontName        259
  21. #define MENU_FontSize        260
  22. #define CNTL_FontNamePopup    256
  23. #define CNTL_FontSizePopup    257
  24. #define PICT_OnDisk            128
  25. #define PICT_InNVRAM        129
  26. #define ACUR_Animator        256
  27. #define LDEF_Stub            1024
  28. #define STRN_Options        128
  29. #define DLOG_About            128
  30. #define ALRT_NonFatalError    129
  31. #define ALRT_FatalError        130
  32. #define DLOG_SetFontInfo    256
  33. #define DLOG_SFPutFile        4000
  34. #define STR_FinderIDString    (-16397)            /* Resource id of help message        */
  35.  
  36. #ifndef REZ
  37. #include <ConditionalMacros.h>
  38. #if GENERATINGPOWERPC == 0
  39.     << error: the following will not work >>
  40. #endif
  41. #include <Types.h>
  42. #include <MixedMode.h>
  43. #include <OSUtils.h>
  44. #include <Files.h>
  45. #include <QuickdrawText.h>
  46. #include <QuickDraw.h>
  47. #include <Events.h>
  48. #include <Errors.h>
  49. #include <Memory.h>
  50. #include <Menus.h>
  51. #include <Controls.h>
  52. #include <Windows.h>
  53. #include <TextEdit.h>
  54. #include <Dialogs.h>
  55. #include <MachineExceptions.h>
  56. #include <PCI.h>
  57. #include <Kernel.h>
  58. #include <NameRegistry.h>
  59. #include <CodeFragments.h>
  60. #include <Devices.h>
  61. #include <Fonts.h>
  62. #include <Resources.h>
  63. #include <LowMem.h>
  64. #include <StandardFile.h>
  65. #include <IntlResources.h>
  66. #include <Script.h>
  67. #include <TextUtils.h>
  68. #include <SegLoad.h>
  69. #include <FixMath.h>
  70. #include <ToolUtils.h>
  71. #include <Gestalt.h>
  72. #include <Printing.h>
  73. #include <AppleTalk.h>
  74.  
  75. #include <stdio.h>
  76. #include <stdlib.h>
  77. #include <string.h>
  78.  
  79. #include "AppleEventCore.h"
  80. #include "TwistDownList.h"
  81.  
  82. /*
  83.  *** Common definitions
  84.  */
  85. #ifndef EXTERN
  86. #define EXTERN                extern
  87. #endif
  88. #ifndef TRUE
  89. #define TRUE                1
  90. #define FALSE                0
  91. #endif
  92. #ifndef NULL
  93. #define NULL                0
  94. #endif
  95. #define    kScrollBarWidth         (16)
  96. #define kAnimationInterval        (6)            /* Ticks                        */
  97. #define kOKButton                (1)
  98. #define kCancelButton            (2)
  99. enum {
  100.     kMinWindowWidth                = 64,
  101.     kMinWindowHeight            = 64
  102. };
  103. #define width(rect)        ((rect).right - (rect).left)
  104. #define height(rect)    ((rect).bottom - (rect).top)
  105. /*
  106.  * Parts of a rectangle
  107.  */
  108. #define topLeft(rect)    (((Point *) &rect)[0])
  109. #define botRight(rect)    (((Point *) &rect)[1])
  110.  
  111. /*
  112.  * Printable characters from the ISO-Invariant character set.
  113.  */
  114. #define IS_ASCII_PRINT(c)    ((c) >= ' ' && (c) <= '~')
  115.  
  116. enum {
  117.     kPrimaryIndentLevel        = 0,
  118.     kSecondaryIndentLevel,
  119.     kValueIndentLevel
  120. };
  121. #define kOneLineFormatLength    (80)
  122. #define kSavedInNVRAM            (kFirstUserFlag)
  123. #define kSavedOnDisk            (kFirstUserFlag << 1)
  124.  
  125. enum {
  126.     kOptionFontName    = 1,
  127.     kOptionFontSize
  128. };
  129.  
  130. #define UNUSED(what) do {    \
  131.             what;            \
  132.         } while (0)
  133.  
  134. /*
  135.  * This is used by the animated cursor subroutine.
  136.  */
  137. typedef struct {
  138.     unsigned short        nFrames;
  139.     unsigned short        nextFrame;
  140.     CursHandle            frame[1];
  141. } ACUR_Record, *ACUR_Ptr, **ACUR_Handle;
  142.  
  143. /*
  144.  * All of the information we need for browsing is stored in an extended
  145.  * window record.
  146.  *
  147.  * Each value (path : property : value) is stored in a TwistDown list element. Each
  148.  * element contains both the property (PString) and path (C string). If there is
  149.  * a property value, it will be stored in a sub-list. This is stored in the
  150.  * registrySiblingSet (REG). After this set has been constructed, the list is
  151.  * sorted and a display SiblingSet is constructed. The elements of this set contain
  152.  * readable text.
  153.  */
  154. typedef struct BrowserRecord {
  155.     WindowRecord        theWindow;
  156.     ListHandle            theList;
  157.     unsigned long        dataIndex;
  158.     unsigned long        dataSize;
  159.     TwistDownSiblingSet    registrySiblingSet;
  160.     TwistDownSiblingSet    displaySiblingSet;
  161.     Boolean                sortByName;
  162.     short                fontNumber;
  163.     short                fontSize;
  164.     Str255                fontNameText;
  165. } BrowserRecord, *BrowserPtr;
  166. #define BROWSER        (*browserPtr)
  167. #define REG            (BROWSER.registrySiblingSet)
  168. #define DIS            (BROWSER.displaySiblingSet)
  169.  
  170. /*
  171.  * Window management functions
  172.  */
  173. OSErr                        MakeNameRegistryBrowserWindow(void);
  174. void                        DoRefreshDisplay(
  175.         BrowserPtr                browserPtr
  176.     );
  177. void                        DoEnumerateNameRegistry(
  178.         BrowserPtr                browserPtr
  179.     );
  180. void                        DisposeBrowser(
  181.         register BrowserPtr        browserPtr
  182.     );
  183. void                        DoContentClick(
  184.         register BrowserPtr        browserPtr,
  185.         const EventRecord        *eventRecordPtr
  186.     );
  187. void                        DoWindowKeyDown(
  188.         register BrowserPtr        browserPtr
  189.     );
  190. void                        UpdateBrowserWindow(
  191.         register BrowserPtr        browserPtr,
  192.         RgnHandle                updateRgn
  193.     );
  194. void                        ActivateBrowser(
  195.         register BrowserPtr        browserPtr,
  196.         Boolean                    isActivating
  197.     );
  198. void                        EnumerateNameRegistry(
  199.         BrowserPtr                browserPtr
  200.     );
  201. TwistDownHdl                FormatThisProperty(
  202.         const RegPropertyNameBuf foundProperty,
  203.         RegPropertyValueSize    propertySize,
  204.         const void                *propertyValue
  205.     );
  206. Boolean                        OneLineProperty(
  207.         const char                *labelText,
  208.         const TwistDownHdl        valueElement,
  209.         char                    *oneLineWork
  210.     );
  211. UInt32                        UnpackDataRecord(
  212.         const TwistDownPtr        thisElement,        /* Locked TwistDownHdl            */
  213.         char                    **pathNameCString,
  214.         char                    **foundPropertyCString
  215.     );
  216.  
  217. /*
  218.  * Rebuild/sort the list and display it.
  219.  */
  220. void                        InitializeDisplayList(
  221.         register BrowserPtr        browserPtr
  222.     );
  223. void                        RebuildDisplayList(
  224.         register BrowserPtr        browserPtr
  225.     );
  226. void                        SortAndDisplayBrowserWindow(
  227.         register BrowserPtr        browserPtr
  228.     );
  229. void                        DecorateBrowserWindow(
  230.         register BrowserPtr        browserPtr
  231.     );
  232. void                        PrintBrowserWindow(
  233.         register BrowserPtr        browserPtr
  234.     );
  235. Boolean                        SetFontInfoDialog(
  236.         register BrowserPtr        browserPtr
  237.     );
  238. void                        DoSetFontInfo(
  239.         register BrowserPtr        browserPtr
  240.     );
  241. pascal void                    DisplayListDrawProc(
  242.         ListHandle                twistDownListHdl,    /* The list itself            */
  243.         TwistDownPtr            twistDownPtr,        /* Locked data handle        */
  244.         const Rect                *viewRect            /* Draw in this area        */
  245.     );
  246. #if 0
  247. pascal OSErr                DisplayListPrintImageProc(
  248.         ListHandle                theList,
  249.         THPrint                    hPrint,
  250.         void                    *clientData,
  251.         StringPtr                dateString,
  252.         const Rect                *pageRect,
  253.         short                    pageNumber
  254.     );
  255. #endif
  256. /*
  257.  * The TwistDownList manager calls this to draw a list element.
  258.  */
  259. pascal void                    DrawThisElement(
  260.         ListHandle                twistDownListHdl,    /* The list itself            */
  261.         TwistDownPtr            twistDownPtr,        /* Locked data handle        */
  262.         const Rect                *viewRect            /* Draw in this area        */
  263.     );
  264.  
  265. /*
  266.  * Output functions.
  267.  */
  268. void                        CreateOutputFile(void);
  269.  
  270. /*
  271.  * Animated Cursor Utilities
  272.  */
  273. void                        SetupAnimatedCursor(
  274.         short                    ACUR_ResID
  275.     );
  276. void                        SpinCursor(void);
  277. extern void                    pstrcpy(
  278.         StringPtr                dst,
  279.         ConstStr255Param        src
  280.     );
  281. extern void                    pstrcat(
  282.         StringPtr                dst,
  283.         ConstStr255Param        src
  284.     );
  285. /*
  286.  * Window utilities.
  287.  */
  288. void                        DoZoomWindow(
  289.         WindowPtr                theWindow,
  290.         short                    whichPart
  291.     );
  292. Boolean                        DoGrowWindow(
  293.         WindowPtr                theWindow,
  294.         Point                    startingPoint,
  295.         short                    minimumWidth,
  296.         short                    minimumHeight
  297.     );
  298. /*
  299.  * Cheap 'n dirty memory clear routine.
  300.  */
  301. #define Clear(dst) do {                                    \
  302.         Ptr                _ptr = (Ptr) &dst;                \
  303.         Size            _size = sizeof dst;                \
  304.         while (_size > 0) {                                \
  305.             *_ptr++ = 0;                                \
  306.             --_size;                                    \
  307.         }                                                \
  308.     } while (0)
  309.  
  310. void                        CheckError(
  311.         OSErr                    errorStatus,
  312.         ConstStr255Param        errorMsg
  313.     );
  314. void                        NonFatalError(
  315.         OSErr                    errorStatus,
  316.         ConstStr255Param        errorMsg
  317.     );
  318. void                        FatalError(
  319.         OSErr                    errorStatus,
  320.         ConstStr255Param        errorMsg
  321.     );
  322. short                        ErrorMessage(
  323.         short                    alertID,
  324.         OSErr                    errorStatus,
  325.         ConstStr255Param        errorMsg
  326.     );
  327.  
  328. /*
  329.  * Global values
  330.  */
  331. EXTERN EventRecord        gEventRecord;
  332. EXTERN Boolean            gQuitNow;
  333. EXTERN Boolean            gUpdateMenusNeeded;
  334. EXTERN BrowserPtr        gCurrentBrowserPtr;
  335. EXTERN short            gOpenWindowCount;
  336. EXTERN MenuHandle        gAppleMenu;
  337. EXTERN MenuHandle        gFileMenu;
  338. EXTERN MenuHandle        gEditMenu;
  339. EXTERN MenuHandle        gOptionMenu;
  340. EXTERN THPrint            gPrintHandle;
  341. EXTERN ACUR_Handle        gACUR_Handle;
  342. EXTERN unsigned long    gACUR_NextAnimation;
  343. EXTERN SFReply            gSFReply;
  344. EXTERN short            gSaveFileRefNum;
  345. extern Boolean            gSaveAllElements;
  346.  
  347. #endif    /* Not REZ */
  348. #endif    /* __NameRegistryDisplay__    */
  349.